﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ITXHWEB.Controllers
{
    public partial class ABFOLGEController
    {
      
        [ChildActionOnly]
        public ActionResult MUA(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            MABF.PropertyChanged += MABF_PropertyChanged;
            return PartialView(MABF);
        }
        private void MABF_PropertyChanged(object s, System.ComponentModel.PropertyChangedEventArgs e)
        {
            //MABF.UAVlaues[e.PropertyName] = s.GetType().GetProperty(e.PropertyName).GetValue(s);
            //MABF.ABPAUF = MABF.Robot1Axis1.ToString();
        }

        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult MUA(ABFOLGEModel model, string returnUrl)
        {
            try
            {
                ModelState.Clear();
                UAValue();
            }
            catch (Exception ex)
            {
                INFO = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);           
        }
        public override void UAValue()
        {
           // MABF.ABPAUF = MABF.Robot1Axis1.ToString()+"/"+ MABF.Robot1Axis2.ToString() + "/" + MABF.Robot1Axis4.ToString();
            base.UAValue();
        }
        public void STOPAM()
        {
            if (MABF.ABES == null)
                return;
            foreach (ABARTEModel item in MABF.ABES)
            {
                PM["INTERVAL"] = item.INTERVAL;
                PM["MSETID"] = item.MSETID;
                PM["CHANNEL"] = item.BDEKEN;
                PM["VALUE"] = item.MNOWTXTV;
                VHP.VABP.STOPAM(PM);
            }
            INFO = "已停止监控";
        }
    }
}
